<template>
    <!-- 就诊记录 模块 -->
    <div class="visit-records">
        <div v-for="(item) in visitRecords" :key="item.id" class="record-item">
            <div
                :class="{ 'top-line': true, 'type1': item.type === 1, 'type2': item.type === 2, 'type3': item.type === 3 }">
                <div class="date">{{ item.date }}</div>
            </div>
            <div class="card" @click="toVisitRecords(item)">
                <div class="one-line">
                    <div class="line-title">
                        <span>{{ item.doctor }}</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { testVisitRecordsData } from './testData'
export default {
    name: 'VisitRecords',
    components: {},
    props: {},
    data() {
        return {
            visitRecords: []
        }
    },
    computed: {},
    watch: {},
    created() {
        this.visitRecords = JSON.parse(JSON.stringify(testVisitRecordsData))
    },
    mounted() { },
    methods: {
        toVisitRecords(item) {
            this.$toast(item.doctor + '：别碰我！')
        }
    }
}
</script>
<style lang='scss' scoped>
.visit-records {
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 14px;
    height: calc(100% - 54px);
    margin-bottom: 10px;
    overflow-y: auto;
}

.record-item {
    position: relative;

    &:not(:last-child):after {
        content: '';
        position: absolute;
        left: 7px;
        top: 20px;
        height: 80%;
        border-left: 2px solid #58bf74;
    }

    .top-line {
        position: relative;
        display: flex;
        flex-wrap: nowrap;
        align-items: flex-start;
        height: 20px;
        padding-left: 20px;
        font-size: 12px;

        &::after {
            content: '';
            position: absolute;
            width: 16px;
            height: 16px;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            border-radius: 50%;
            background: url() 50% no-repeat scroll;
            background-size: cover;
        }

        .date {
            height: 20px;
            line-height: 24px;
            margin-left: 10px;
            color: #424E67;
        }
    }

    .type2 {
        &::after {
            background: url() 50% no-repeat scroll !important;
            background-size: cover !important;
        }
    }


    .card {
        padding: 6px 10px;
        border-radius: 4px;
        color: #000;
        font-size: 14px;
        font-weight: bold;
        margin-bottom: 10px;
        margin-left: 20px;
        margin-top: 6px;

        .one-line {
            display: flex;
            flex-wrap: nowrap;
            justify-content: space-between;
        }

        .line-title {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
    }
}
</style>